잠시만 기다려 주세요

     '싸우지 않는 이재명을 규탄한다. 민생충, 협치충, 역풍충.. 국민들은 치가 떨린다.'
전체검색 :  
이번주 로또 및 연금번호 발생!!   |  HOME   |  여기는?   |  바다물때표   |  알림 (16)  |  여러가지 팁 (1054)  |  추천 및 재미 (150)  |  자료실 (22)  |  
시사, 이슈, 칼럼, 평론, 비평 (582)  |  끄적거림 (127)  |  문예 창작 (702)  |  바람 따라 (69)  |  시나리오 (760)  |  드라마 대본 (248)  |  
살인!


    postgresql

postgresql - postgresql 유용한 쿼리, 통계보기.. 조회
이 름 : 바다아이   |   조회수 : 9223         짧은 주소 : https://www.bada-ie.com/su/?201591855986
- 현재 active중인 쿼리 보기
select * from pg_stat_activity;

- db 통계정보 보기
SELECT * FROM pg_stat_database;

- 테이블 통계정보 보기
select * from pg_stat_all_tables

- db사이즈 조회
select * from pg_size_pretty(pg_database_size('testDatabase'));

- tablespace size조회
select * from pg_size_pretty(pg_tablespace_size('pg_default'));

-현재 스키마 조회
select current_schema(); 

- table 목록 보기
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

- db목록 보기
postgresql: \l
postgresql: SELECT datname FROM pg_database;

- 컬럼 내용 보기
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

- DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table'


- user 정보 보기

select * from pg_user where usename = CURRENT_USER;


- 현재 유저 정보 보기

select CURRENT_USER;


-function 내용보기

SELECT prosrc FROM pg_proc WHERE proname = 'partitioning_trigger_login';



-index 조회하기

	
SELECT i.relname as indname,
       i.relowner as indowner,
       idx.indrelid::regclass,
       am.amname as indam,
       idx.indkey,
       ARRAY(
       SELECT pg_get_indexdef(idx.indexrelid, k + 1, true)
       FROM generate_subscripts(idx.indkey, 1) as k
       ORDER BY k
       ) as indkey_names,
       idx.indexprs IS NOT NULL as indexprs,
       idx.indpred IS NOT NULL as indpred
FROM   pg_index as idx
JOIN   pg_class as i
ON     i.oid = idx.indexrelid
JOIN   pg_am as am
ON     i.relam = am.oid
and i.relname not like 'pg%';



-컴마 붙이기

 select to_char(123456789, 'FM999,999,990'); 


-index table space 변경

ALTER INDEX tb_ham_log_login_2013_11_first_idx1 SET TABLESPACE tbs_ham


출처: http://dbguide.tistory.com/entry/postgresql-유용한-쿼리?category=487971 [IT WORLD]
| |





      1 page / 2 page
번 호 카테고리 제 목 이름 조회수
45 postgresql postgresql ... postgresql 14 .. postgresql.conf port 5432 .. 바다아이 673
44 postgresql , count(*) .... 바다아이 6852
43 postgresql How to do an update + join in PostgreSQL?, 바다아이 6083
42 postgresql sequence(퀀) 바다아이 7716
41 postgresql , , , index create, , 바다아이 8097
40 postgresql postgresql log_timezone .... 바다아이 6500
39 postgresql postgresql SEQUENCE reset .... 바다아이 8337
38 postgresql [PostgreSql] WITH , , Operator 바다아이 7728
37 postgresql postgresql for, foreach , 바다아이 9284
36 postgresql postgresql , , into ... 바다아이 9282
35 postgresql postgresql PL/pgSQL - SQL Procedural Language, , 바다아이 10696
34 postgresql postgresql ... .. , , 바다아이 11711
33 postgresql postgresql CSV export/import 바다아이 8514
32 postgresql postgresql tablespace , .... 바다아이 12836
31 postgresql postgresql 10 partitioning, ... , ... 바다아이 9253
30 postgresql Using PostgreSQL Arrays, ... ... 바다아이 9219
29 postgresql PostgreSQL (TRIGGER) (function) 바다아이 8983
28 postgresql Optimize and Improve PostgreSQL Performance with VACUUM, ANALYZE, and REINDEX 바다아이 9632
27 postgresql postgresql tuple . vacuumdb .. , . 바다아이 9029
현재글 postgresql postgresql , .. 바다아이 9224
25 postgresql postgresql , size, 바다아이 11223
24 postgresql postgresql , , .... 바다아이 8270
23 postgresql PostgreSQL Replication, , , master, slave 바다아이 10770
22 postgresql postgresql case 바다아이 8138
21 postgresql postgresql with 바다아이 8575
20 postgresql postgresql , , string 바다아이 11480
19 postgresql Postgresql partitioning table , , , 바다아이 9072
18 postgresql PostgreSQL 바다아이 10561
17 postgresql postgresql vacuumdb, psql, pg_dump password crontab , pgpass 바다아이 10245
16 postgresql postgresql sequence 퀀 auto_increment . 바다아이 9665
| |









Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천  실행시간 : 0.05764
to webmaster... gogo sea. gogo sea.